//
//  golf.cpp
//  Practice9
//
//  Created by 赵世杰 on 2020/7/5.
//  Copyright © 2020 zhaoshijie. All rights reserved.
//

#include "golf.hpp"
#include <iostream>


/*
const int Len = 40;

struct golf {
    
    char fullname[Len];
    int handicap;
    
};

void setgolf(golf &g, const char *name, int hc);

void setgolf(golf &g);

void handicap(golf &g ,int hc);

void showgolf(const golf &g);
 */


using namespace std;



Golf::Golf(const char*name ,const int hc)
{
    stpcpy(fullname, name);
    
    handicap = hc;
    
}




void Golf:: setgolf( const char *name, int hc)
{
    
    stpcpy(fullname, name);
    handicap = hc;
    
    
    cout << "name: " << fullname << " handicap: " << handicap << endl;
    
}


int Golf:: setgolf()
{
    string name ;
    
    cout << "请输入name：" ;
    
    getline(cin, name);
    
    stpcpy(fullname, name.c_str());
    
//    cin.get();
//    cin.clear();
    
    cout << "请输入handicap：" ;
    
    int handicap ;
    
    cin >> handicap;
    
    handicap = handicap;
    
    cout << "name: " << fullname << " handicap: " << handicap << endl;
    
    
    if(name == "")
    {
        return 0;
    }
    else
    {
        return 1;
    }
    
}

void Golf:: setHandicap(int hc)
{
    handicap = hc;
    
    cout << "name: " << fullname << " handicap: " << handicap << endl;
    
}

void Golf:: showgolf()
{
    
    cout << "name: " << fullname << " handicap: " << handicap << endl;
}


